import request from "@/utils/request"

//根据用户的uid查找购物车数据
const findCartMessage = (uid) => {
    return request({
        url: `/api/cart/find/${uid}`,
        method: "get"
    })
}

//删除购物车中的商品
const deleteCartMessage = (id) => {
    return request({
        url: `/api/cart/delete/${id}`,
        method: "get"
    })
}
//加入购物车
//cartInfo:购物车信息
//鞋子id、尺码、数量、uid
const addToCartMessage = (cartInfo) => {
    return request({
        headers: { "Content-Type": "application/json;charset=utf-8" },
        url: `/api/cart/add`,
        method: "post",
        data: cartInfo
    })
}

//根据用户id删除购物车中的所有商品
const deleteCartByUserId = (uid) => {
    return request({
        url: `/api/cart/delete/${uid}`,
        method: "get"
    })
}

export { findCartMessage, deleteCartMessage, addToCartMessage,deleteCartByUserId }
